package com.itheima.service;

/*
*@ClassName: PermissionServiceImpl
*@author: 海绵宝宝
*@date: 2019/7/26
*@time:   9:57
*/

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.dao.PermissionDao;
import com.itheima.entity.PageResult;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Permission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;


@Service(interfaceClass = PermissionService.class)
@Transactional
public class PermissionServiceImpl implements PermissionService{
    @Autowired
    PermissionDao permissionDao;

    @Override
    //新增权限
    public void add(Permission permission) {
        permissionDao.add(permission);
    }

    @Override
    public PageResult findPage(Integer currentPage, Integer pageSize, String queryString) {
        PageHelper.startPage(currentPage, pageSize);
        Page<Permission> pages = permissionDao.findPage(queryString);
        return new PageResult(pages.getTotal(), pages.getResult());

    }


}
